package name.vaccari.matteo.tai.phonedirectory.network;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;

public class EchoProtocol implements Protocol {

	public void process(InputStream is, OutputStream os) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(is));
		PrintWriter writer = new PrintWriter(os);
		
		while (true) {
			String line = reader.readLine();
			if (null == line) break;
			writer.println(line);
			writer.flush();
		}
	}

}
